package com.sudo.web.task;

import com.sudo.rpc.api.utils.RpcRes;
import com.sudo.rpc.server.annotation.Note;
import com.sudo.rpc.server.annotation.TaskComponent;
import com.sudo.rpc.server.service.ServerInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Map;

@Slf4j
@TaskComponent
public class Task1Module {

    @Autowired(required = false)
    private ServerInfoService serverInfoService;


    /**
     * 获取服务器节点内存实时信息
     */
    @Note(desc = "节点内存|Cpu信息")
    public RpcRes getServerCpuMemToRedis() {
        Map<String, Object> objectMap = serverInfoService.getServerDynamicMemCpu();
        return RpcRes.okCall(objectMap);
    }

    /**
     * 根据服务器节点获取系统信息
     */
    @Note(desc = "节点系统信息")
    public RpcRes getServerSysInfo() {
        Map<String, Object> objectMap = serverInfoService.getServerSysInfo();
        return RpcRes.okCall(objectMap);
    }

}
